<template>
	<view class="page p15">
		<view>
			<view v-for="(item,index) in list" :key="index" class="bg-white p15 brs5 mb10">
				<view class="u-flex u-f-jsb fz17 u-font-bold bm pb10">
					<view class="">{{item.shop.name}}</view>
					<view style="color: red;">￥{{item.price}}</view>
				</view>
				<view class="u-f3 fz15 c6 mt10">
					车牌号：{{item.car}}
				</view>
				<view class="u-f1 fz15 c6 mt10">
					下单日期：{{item.pay_time}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				loadStatus:'',
				list:[]
			}
		},
		computed: {},
		onShow() {
			this.initData()
		},
		// 页面下拉到底部触发
		onReachBottom() {},
		methods: {
			initData() {
				this.page = 1
				this.list = []
				this.getList()
			},
			getList() {


				this.$api.orderList({
					page: this.page,
				}, res => {
					if (res.code) {

						let _list = res.data.data

						this.list = [...this.list, ..._list]
						
							console.log(this.list)
						// 判断所有数据是否请求完毕
						if (res.data.total > this.list.length) {
							this.page++
							this.loadStatus = 'more'
						} else {
							this.loadStatus = 'noMore'
						}
					} else {
						this.$common.errorToShow(res.msg)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
.btn{
	background: #ffd100;
	border-radius: 50rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size:28rpx;
	color: #fff;
	padding: 14rpx 32rpx;
	position: absolute;
	right: 0;
	top: -20rpx;
}
</style>